package com.jf3q.front.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jf3q.common.domain.EduBanner;
import com.jf3q.common.domain.EduTeacher;
import com.jf3q.common.service.TeacherService;
import com.jf3q.common.vo.ResultVo;
import com.jf3q.front.service.BannerFrontService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController()
@RequestMapping("/indexfront")
public class CourseAndTeacherController {
    @Autowired
    private TeacherService teacherService;

    @GetMapping("/IndexTeacher")
    public ResultVo getAllTeacher() {
        LambdaQueryWrapper<EduTeacher> queryWrapper= new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(EduTeacher::getEduCreate);
        //last方法，拼接sql语句
        queryWrapper.last("limit 4");//显示最新的两个图
        List<EduTeacher> list = teacherService.list();
        return ResultVo.success(list);
    }
}
